﻿


-- 人员排班信息获取
create procedure [dbo].[RypbInfo_Get]
@sfzh varchar(18) = null,
@xm varchar(10) = null,
@qybmm varchar(100) = null,
@pbsj datetime = null,
@bcid int = null,
@top int =0
as
set rowcount @top
select sfzh,xm,qybmm,pbsj,Rypb_Info.bcid,bcm,substring(sjd1ks,0,6) sjd1ks,substring(sjd1js,0,6) sjd1js,
substring(sjd2ks,0,6) sjd2ks,substring(sjd2js,0,6) sjd2js,
substring(sjd3ks,0,6) sjd3ks,substring(sjd3js,0,6) sjd3js,
substring(sjd4ks,0,6) sjd4ks,substring(sjd4js,0,6) sjd4js
from Rypb_Info inner join Bc_Info
on(Rypb_Info.bcid=Bc_Info.bcid)
where 
(@sfzh is null or sfzh like @sfzh+'%') and
(@xm is null or xm like '%'+@xm+'%') and
(@qybmm is null or qybmm=@qybmm) and
(@pbsj is null or pbsj=@pbsj) and
(@bcid is null or Rypb_Info.bcid=@bcid)
order by pbsj 

select count(1) from Rypb_Info
set rowcount 0